PostgreSQL

class PostgreSQL(url: String, username: String, password: String, options: ERROR CLASS: Symbol not found for ConnectionPool.Options = ConnectionPool.Options(), val encoders: ERROR CLASS: Symbol not found for ValueEncoderRegistry = ValueEncoderRegistry()) : IPostgresSQL(source)

PostgreSQL class provides mechanisms to interact with a PostgreSQL database. It implements Driver, Driver.Pool, and Driver.Transactional interfaces, offering functionalities such as connection pooling, executing queries, fetching data, and handling transactions.

The URL scheme designator can be either postgresql:// or postgres://. Each of the URL parts is optional.

postgresql:// postgresql://localhost postgresql://localhost:5433 postgresql://localhost/mydb

Parameters

url

The URL of the PostgreSQL database to connect to.

username

The username used for authentication.

password

The password used for authentication.

options

Optional pool configuration, defaulting to Driver.Pool.Options.

encoders

Optional registry of value encoders to use for encoding query parameters.

Constructors

Link copied to clipboard
constructor(url: String, username: String, password: String, options: ERROR CLASS: Symbol not found for ConnectionPool.Options = ConnectionPool.Options(), encoders: ERROR CLASS: Symbol not found for ValueEncoderRegistry = ValueEncoderRegistry())

Types

Link copied to clipboard
object Companion
Link copied to clipboard
class SqlxConnection(rt: ERROR CLASS: Symbol not found for CPointer<out ERROR CLASS: Symbol not found for CPointed>, cn: ERROR CLASS: Symbol not found for CPointer<out ERROR CLASS: Symbol not found for CPointed>, val encoders: ERROR CLASS: Symbol not found for ValueEncoderRegistry) : <ERROR CLASS> ERROR CLASS: Symbol not found for Connection
Link copied to clipboard
class SqlxTransaction(rt: ERROR CLASS: Symbol not found for CPointer<out ERROR CLASS: Symbol not found for CPointed>, tx: ERROR CLASS: Symbol not found for CPointer<out ERROR CLASS: Symbol not found for CPointed>, val encoders: ERROR CLASS: Symbol not found for ValueEncoderRegistry) : <ERROR CLASS> ERROR CLASS: Symbol not found for Transaction

Properties

Link copied to clipboard
open override val encoders: ERROR CLASS: Symbol not found for ValueEncoderRegistry

Functions

Link copied to clipboard
open suspend override fun acquire(): ERROR CLASS: Symbol not found for Result<ERROR CLASS: Symbol not found for Connection>
Link copied to clipboard
open suspend override fun begin(): ERROR CLASS: Symbol not found for Result<ERROR CLASS: Symbol not found for Transaction>
Link copied to clipboard
open suspend override fun close(): ERROR CLASS: Symbol not found for Result<kotlin/Unit>
Link copied to clipboard
open suspend override fun execute(sql: String): ERROR CLASS: Symbol not found for Result<kotlin/Long>
Link copied to clipboard
open suspend override fun fetchAll(sql: String): ERROR CLASS: Symbol not found for Result<ERROR CLASS: Symbol not found for ResultSet>
Link copied to clipboard
open suspend override fun listen(channel: String, f: suspend (Notification) -> Unit)

Listens to a specific PostgreSQL channel and processes notifications using the provided callback function.

open suspend override fun listen(channels: List<String>, f: suspend (Notification) -> Unit)

Listens to notifications on the specified PostgreSQL channels and processes them using the provided callback function. The notifications are received via the PostgreSQL listen/notify mechanism.

Link copied to clipboard
open suspend override fun migrate(path: String, table: String, schema: String?, createSchema: Boolean, afterStatementExecution: suspend (ERROR CLASS: Symbol not found for Statement, ERROR CLASS: Symbol not found for Duration) -> Unit, afterFileMigration: suspend (ERROR CLASS: Symbol not found for Migration, ERROR CLASS: Symbol not found for Duration) -> Unit): ERROR CLASS: Symbol not found for Result<ERROR CLASS: Symbol not found for Migrator.Results>
Link copied to clipboard
open suspend override fun notify(channel: String, value: String)

Sends a notification to a specific PostgreSQL channel with the given value.

Link copied to clipboard
open override fun poolIdleSize(): Int
Link copied to clipboard
open override fun poolSize(): Int
Link copied to clipboard
open fun validateChannelName(channel: String)

Validates the name of a PostgreSQL channel to ensure it adheres to the naming rules.